package paneles;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ListSelectionModel;

import java.awt.BorderLayout;
import java.awt.GridBagLayout;
import java.awt.GridLayout;

import javax.swing.JLabel;
import java.awt.GridBagConstraints;
import javax.swing.JList;
import java.awt.Insets;
import javax.swing.JButton;
import javax.swing.border.TitledBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

public class PanelIndex extends JPanel implements ListSelectionListener {
	private JPanel contentPane;
	private JList list;

	/**
	 * Create the panel.
	 */
	public PanelIndex() {
		setBorder(new TitledBorder(null, "Indices", TitledBorder.LEADING,
				TitledBorder.TOP, null, null));
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[] { 115, 115, 0 };
		gridBagLayout.rowHeights = new int[] { 182, 23, 0, 0, 0 };
		gridBagLayout.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
		gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0,
				Double.MIN_VALUE };
		setLayout(gridBagLayout);
		contentPane = new JPanel();
		list = new JList();
		list.setBounds(427, 5, 2, 252);
		String[] arr = new String[40];
		arr[0] = "1test1";
		arr[1] = "2test2";
		arr[2] = "3test3";
		arr[3] = "4test4";
		arr[4] = "5test5";
		arr[5] = "1test1";
		arr[6] = "2test2";
		arr[7] = "3test3";
		arr[8] = "4test4";
		arr[9] = "5test5";
		arr[10] = "1test1";
		arr[11] = "2test2";
		arr[12] = "3test3";
		arr[13] = "4test4";
		arr[14] = "5test5";
		arr[15] = "1test1";
		arr[16] = "2test2";
		arr[17] = "3test3";
		arr[18] = "4test4";
		arr[19] = "5test5";
		arr[20] = "1test1";
		arr[21] = "2test2";
		arr[22] = "3test3";
		arr[23] = "4test4";
		arr[24] = "5test5";
		arr[25] = "1test1";
		arr[26] = "2test2";
		arr[27] = "3test3";
		arr[28] = "4test4";
		arr[29] = "5test5";
		list.setListData(arr);
		// list.setVisibleRowCount(5);
		list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		list.addListSelectionListener(this);

		JScrollPane scrollPane = new JScrollPane(list);
		scrollPane.setBounds(5, 5, 112, 73);
		setLayout(new BorderLayout(10, 10));
		add(scrollPane, BorderLayout.CENTER);
		add(contentPane, BorderLayout.SOUTH);
		scrollPane
				.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
		contentPane.setLayout(new GridLayout(1, 2));
		GridBagConstraints gbc_scrollPane = new GridBagConstraints();
		gbc_scrollPane.insets = new Insets(0, 0, 5, 0);
		gbc_scrollPane.gridwidth = 7;
		gbc_scrollPane.gridx = 1;
		gbc_scrollPane.gridheight = 13;
		gbc_scrollPane.gridy = 0;
		//add(scrollPane, gbc_scrollPane);
		GridBagConstraints gbc_list = new GridBagConstraints();
		gbc_list.insets = new Insets(0, 0, 5, 5);
		gbc_list.gridx = 0;
		gbc_list.gridy = 1;
		//add(list, gbc_list);

		JButton btnNewButton = new JButton("Buscar por Index");
		GridBagConstraints gbc_btnNewButton = new GridBagConstraints();
		gbc_btnNewButton.gridwidth = 3;
		gbc_btnNewButton.insets = new Insets(0, 0, 0, 5);
		gbc_btnNewButton.gridx = 4;
		gbc_btnNewButton.gridy = 13;
		contentPane.add(btnNewButton, gbc_btnNewButton);

		JButton btnNewButton_1 = new JButton("Top 10 Index");
		GridBagConstraints gbc_btnNewButton_1 = new GridBagConstraints();
		gbc_btnNewButton_1.insets = new Insets(0, 0, 0, 5);
		gbc_btnNewButton_1.gridwidth = 3;
		gbc_btnNewButton_1.gridx = 1;	
		gbc_btnNewButton_1.gridy = 3;
		contentPane.add(btnNewButton_1, gbc_btnNewButton_1);

	}

	@Override
	public void valueChanged(ListSelectionEvent arg0) {
		// TODO Auto-generated method stub

	}

}
